#include <stdio.h>
#include <stdlib.h>
#include "../Includes/Driver.h"
#include "../Includes/Messaging.h"
#include "../Includes/Rendering.h"

/// <summary>
/// Globals
/// </summary>
Framebuffer fbo0;

/// <summary>
/// Locals
/// </summary>
static Driver drv =
{
	.state = 0,
	.name = "Empty",
	.framebuffer = NULL,
};

/// <summary>
/// Methods
/// </summary>
int DRVInit(void)
{
	/* Generic Init */
	if (FBDInit(&drv) < 0)
		return -1;

	/* DRM Init */
	if (DRMInit(&drv) < 0)
		return 0;

	/* Cursor Init */
	if (CRSInit(&drv) < 0)
		return -1;

	return 0;
}

/// <summary>
/// TODO
/// </summary>
int DRVOpen(void)
{
	if (drv.Open() < 0)
		return -1;
	return 0;
}

/// <summary>
/// TODO
/// </summary>
int DRVCreateFramebuffer(void)
{
	if (drv.CreateFramebuffer(&fbo0) < 0)
		return -1;
	return 0;
}

/// <summary>
/// Methods
/// </summary>
int DRVExit(void)
{
	if (drv.state == 0)
		return -1;
	return 0;
}

